<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="/plugins/jquery/jquery.min.js"></script>
<script src="/js/common.js"></script>
<link href="https://cdn.bootcss.com/pace/1.0.2/themes/pink/pace-theme-flash.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="/plugins/layui/css/layui.css" media="all"/>
<link rel="stylesheet" type="text/css" href="https://at.alicdn.com/t/font_520106_q8xykrwf86ywrk9.css" media="all"/>
<style>
    .passwordTitle{ margin:0 auto; width:220px; height:70px;font-size: 26px;margin-top:20px;letter-spacing:4px;}
    .passwordContent{ margin:0 auto; width:790px; height:80px;font-size: 26px;letter-spacing:4px;}
</style>
<script type="text/javascript">
    $(document).ready(function(){
        var url = location.search;
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            strs = str.split("&");

            var id = decodeURIComponent(strs[0].replace("id=",""));
            $.get("/cms/employeeManager/getCodeAndPassword.json/?id="+id, function(data,status) {
                    /*console.log("Data: " + data.data.code + "nStatus: " + status);
                    console.log("Data: " + data.data.name + "nStatus: " + status);
                    console.log("Data: " + data.data.password + "nStatus: " + status);
                    console.log("Data: " + data.data.createTime + "nStatus: " + status);*/

                $("#name").html(data.data.name);
                $("#code").html(data.data.code);
                $("#password").html(data.data.password);
                var date = new Date();
                date = date.toLocaleDateString();
                date = date.replace('/','-');
                date = date.replace('/','-');
                $("#createDate").html(date); //获取当前日期;

                //页面数据加载完生成自动将页面转为图片供下载
                html2canvas($("#downLoadConten")[0]).then(function (canvas) {
                    var imgUri = canvas.toDataURL();
                    $("#downLoadImg").attr('href', imgUri);
                });
            });
        }
    })
    function doPrint() {
        bdhtml=window.document.body.innerHTML;
        sprnstr="<!--startprint-->";
        eprnstr="<!--endprint-->";
        prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
        prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
        window.document.body.innerHTML=prnhtml;
        window.print();
        window.location.reload();
    }

</script>
<body style="margin:auto;">
    <div id="downLoadConten" style="width: 830px;margin: auto;">
    <!--startprint-->
        <div align="center" class="passwordTitle">
            <h3><strong><span style="font-size:24px;">用户开户函</span></strong></h3>
        </div>
        <div class="passwordContent" style="height: 110px">
            &nbsp;&nbsp;&nbsp;&nbsp;尊敬的 <span id="name"></span> 用户，您在珠海金湾区人才服务管理系统开户成功。
        </div>
        <div class="passwordContent">
            &nbsp;&nbsp;&nbsp;&nbsp;账号：<span id="code"></span>，初始密码:<span id="password"></span>，登陆网址:http://jinwanrc.com:8080/.首次登陆完善基本信息后，请及时修改初始密码。如遗忘密码，请向上一级用户申请重置。
        </div>
        <div align="center" style="margin:0 auto; font-size: large;margin-top: 80px;font-size: 22px;">
            <div style="height:38px;padding-top: 30px;">
                 <span>珠海市金湾区人才服务管理系统</span>
            </div>
            <div style="height:38px;margin-top: 30px;">
                <span id="createDate"></span>
            </div>
        </div>
    <!--endprint-->
    </div>
    <div align="center" style="margin-top: 20px;">
        <button  class="layui-btn layui-btn-lg passwordTitle1" onclick="doPrint()">打印</button>
        <a id="downLoadImg" href="" download="用户开户函.jpg" class="layui-btn layui-btn-lg">下载</a>
    </div>
</body>
</html>
<script type="text/javascript" src="/js/html2canvas.min.js"></script>